package net;

import java.net.InetAddress;
import java.net.UnknownHostException;
/*
InetSddress对象：代表ip
 */
public class Demo1 {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress address = InetAddress.getByName("10.85.167.228");
        System.out.println(address);
        //获取主机名
        System.out.println(address.getHostName());
        //获取ip地址
        System.out.println(address.getHostAddress());
    }
}
